/**
 * @version Create on 2012-10-29
 * @author Yinzi Chen
 */

public class ContainerWithMostWater {

	public int maxArea(int[] height) {
		int n = height.length;
		if (n < 2)
			return 0;
		int l = 0, r = n - 1;
		int max = 0;
		while (l < r) {
			max = Math.max(max, (r - l) * Math.min(height[l], height[r]));
			if (height[l] > height[r])
				r--;
			else
				l++;
		}
		return max;
	}

	public static void main(String[] args) {

	}

}
